package com.zzj.controller;

import com.zzj.handle.WebSocket;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/webSocket")
public class WebSocketController {

    @Resource
    private WebSocket webSocket;

    @PostMapping("/sendMessage")
    public void sendMessage(String username, String message) throws IOException {
        webSocket.sendMessageByUsername(username, "", message);
    }
}
